import React, { Component } from 'react';
import { TabBar } from 'antd-mobile';

// 引入图片
import cookbook from '@/assets/imgs/cookbook.png'
import cookbookActive from '@/assets/imgs/cookbook-active.png'
import menu from '@/assets/imgs/menu.png'
import menuActive from '@/assets/imgs/menu-active.png'
import more from '@/assets/imgs/more.png'
import moreActive from '@/assets/imgs/more-active.png'
//导入组件
import Cookbook from '@/view/cookbook'

class index extends Component {
    state = {
        selectedTab: 'cookbook',
        hidden: false,
        
      }; 
      
      renderContent(pageText) {
        <div></div>
    
      }
    render() {
        return (
            <div style={{ position: 'fixed', height: 'calc(100% - 40px)', width: '100%', top: 40 }}>
        <TabBar
          unselectedTintColor="#949494"
          tintColor="#000"
          barTintColor="white"
          hidden={this.state.hidden}
        >
          <TabBar.Item
            title="菜谱"
            key="Life"
            icon={<div style={{
              width: '22px',
              height: '22px',
              background: `url(${cookbook}) center center /  21px 21px no-repeat` }}
            />
            }
            selectedIcon={<div style={{
              width: '22px',
              height: '22px',
              background: `url(${cookbookActive}) center center /  21px 21px no-repeat` }}
            />
            }
            selected={this.state.selectedTab === 'cookbook'}
            // badge={1}
            onPress={() => {
              this.setState({
                selectedTab: 'cookbook',
              });
            }}
            data-seed="cookbook"
          >
            {/* {this.renderContent('Life')} */}
            <Cookbook/>
          </TabBar.Item>

          <TabBar.Item
            title="菜谱"
            key="Life"
            icon={<div style={{
              width: '22px',
              height: '22px',
              background: `url(${menu}) center center /  21px 21px no-repeat` }}
            />
            }
            selectedIcon={<div style={{
              width: '22px',
              height: '22px',
              background: `url(${menuActive}) center center /  21px 21px no-repeat` }}
            />
            }
            selected={this.state.selectedTab === 'menu'}
            // badge={1}
            onPress={() => {
              this.setState({
                selectedTab: 'menu',
              });
            }}
            data-seed="logId"
          >
            {this.renderContent('menu')}
          </TabBar.Item>

          <TabBar.Item
            title="菜谱"
            key="Life"
            icon={<div style={{
              width: '22px',
              height: '22px',
              background: `url(${more}) center center /  21px 21px no-repeat` }}
            />
            }
            selectedIcon={<div style={{
              width: '22px',
              height: '22px',
              background: `url(${moreActive}) center center /  21px 21px no-repeat` }}
            />
            }
            selected={this.state.selectedTab === 'more'}
            // badge={1}
            onPress={() => {
              this.setState({
                selectedTab: 'more',
              });
            }}
            data-seed="logId"
          >
            {this.renderContent('more')}
          </TabBar.Item>
        </TabBar>
      </div>
        );
    }
}

export default index;
